#include <dht11.h>

dht11 DHT11;

const int ledPin1 = 13;
const int ledPin2 = 8;

void setup() 
{
  Serial.begin(9600);
  pinMode (ledPin1, OUTPUT);      // sets the digital pin as output
  pinMode (ledPin2, OUTPUT);      // sets the digital pin as output
}

void getdata(int iPuerto)
{
  int chk = DHT11.read(iPuerto);
  switch (chk)
  {
    case 0:   
              break;
    case -1: Serial.println(" Checksum error"); break;
    case -2: Serial.println(" Time out error"); break;
    default: Serial.println(" Unknown error"); break;
  }
}


void loop() 
{
  getdata(2);
      int feuchte2 = (DHT11.humidity);
  getdata(4);
      int feuchte4 = (DHT11.humidity);  
//  takepause;


  if (feuchte2 > feuchte4) {
    digitalWrite(ledPin1, HIGH);
    digitalWrite(ledPin2, LOW);
    Serial.print(feuchte2);
    Serial.print(" ");
    Serial.println(feuchte4);   
  } 
  else {
    digitalWrite(ledPin1, LOW); 
    digitalWrite(ledPin2, HIGH);    
    Serial.println(" 4 groesser 2 ");
  }

  delay(2000);

}

// Alle Stunde eine Minute Lüfter an
//    digitalWrite(ledPin1, LOW); 
//    digitalWrite(ledPin2, HIGH);   
//    delay(
